<?php
include('db.php');
session_start();
$session_id='1'; //$session id
?>
<html>
<head>
<title>Ajax Image Upload 9lessons blog</title>
</head>

<script type="text/javascript" src="scripts/jquery.min.js"></script>
<script type="text/javascript" src="scripts/jquery.wallform.js"></script>

<script type="text/javascript" >
 $(document).ready(function() {

            $('#photoimg').die('click').live('change', function()			{
			           //$("#preview").html('');

				$("#imageform").ajaxForm({target: '#preview',
				     beforeSubmit:function(){

					console.log('v');
					$("#imageloadstatus").show();
					 $("#imageloadbutton").hide();
					 },
					success:function(){
					console.log('z');
					 $("#imageloadstatus").hide();
					 $("#imageloadbutton").show();
					},
					error:function(){
							console.log('d');
					 $("#imageloadstatus").hide();
					$("#imageloadbutton").show();
					} }).submit();


			});
        });
</script>
<body>

<form id="imageform" method="post" enctype="multipart/form-data" action='ajaximage.php'>
Upload your image
<div id='imageloadstatus' style='display:none'><img src="loader.gif" alt="Uploading...."/></div>
<div id='imageloadbutton'>
<input type="file" name="photoimg" id="photoimg" />
</div>
</form>

</body>
</html>